package com.qk.web.config;

import com.qk.web.interceptor.LoginCheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {


//    @Autowired
//    private MyInterceptor myInterceptor;
    @Autowired
    private LoginCheckInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                  .addPathPatterns("/**")//所有接口都拦截
                  .excludePathPatterns("/login");//登录接口不拦截

//         registry.addInterceptor(myInterceptor)
//                 .addPathPatterns("/**")
//                 .excludePathPatterns("/login");
    }
}